<template>
	<view class="goods_list">
		<goods-list :goods="goods"></goods-list>
		<view class="isOver" v-if="flag">-----尼玛别拉了没数据了</view>
	</view>
</template>

<script>
		import goodsList from '../../components/goods-list/goods-list.vue';
	export default {
		
		components:{
			goodsList
		},
		
		data() {
			return {
				
				page:1,
				goods:[],
				flag: false
				
			}
		},
		onLoad() {
		this.getGoodsList()	
		},
		methods: {
		async	getGoodsList(){
			const res=	await this.$myRequest({
					url:'coupon/dtarticle/list?page='+this.page+'&limit=10'
				})
				        //= this.goods 之前的数据
						//res.data.page.list 请求的数据
				this.goods = [...this.goods,...res.data.page.list]
				this.goods = res.data.page.list;
				console.log(res)
			},
			
		},
		onReachBottom() {
			if(this.goods.length< this.page*10) return this.flag = true
			this.page ++
			this.getGoodsList()
		}
	}
</script>

<style lang="scss">
.goods_list{
	background:#eee;
}

.isOver{
	width: 100%;
	height: 50px;
	line-height: 50px;
	text-align: center;
	font-size: 28rpx;
}
</style>
